﻿using System;
using CodeArt.SharePoint.CamlQuery;
using Microsoft.SharePoint;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestProject2
{
    [TestClass]
    public class UnitTest2
    {
        [TestMethod]
        public void TestGetItemFromView()
        {
            var url = "http://localhost:81/sites/s2";

            SPSite site = new SPSite(url);

            SPList list = site.RootWeb.Lists["任务"];

            QueryField field1 = new QueryField("Title");

            //var items =
            //   ListQuery.Select(field1)
            //   .From(list.DefaultView)
            //   .GetItems();

           // Assert.IsTrue(items.Count == list.Items.Count);

           var items =
                ListQuery.Select(1,field1)
                .From(list.DefaultView)
                .Where(field1.Contains("222"))
                .OrderBy(field1)
                .GetItems();

            Assert.IsTrue(items.Count == 0);
        }
    }
}
